From: Stefan Kangas Date: Sun, 10 Jul 2022 04:30:35 +0000 (+0200) Subject: Merge from origin/emacs-28 X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1^2~5^2~16^2~1886^2~1056 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=c8c8bbd8551e1c19e9b76fe1e1f36e52e55ed040;p=emacs.git Merge from origin/emacs-28 115261b323 ; Improve wording of recently-changed doc strings. --- c8c8bbd8551e1c19e9b76fe1e1f36e52e55ed040 diff --cc lisp/files.el index 2ea9d1e4673,12121872748..b99ccf66d8a --- a/lisp/files.el +++ b/lisp/files.el @@@ -441,52 -418,17 +441,53 @@@ idle for `auto-save-visited-interval' s (when auto-save--timer (timer-set-idle-time auto-save--timer value :repeat)))) +(defcustom auto-save-visited-predicate nil + "Predicate function for `auto-save-visited-mode'. + +If non-nil, the value should be a function of no arguments; it +will be called once in each file-visiting buffer when the time +comes to auto-save. A buffer will be saved only if the predicate +function returns a non-nil value. + +For example, you could add this to your Init file to only save +files that are both in Org mode and in a particular directory: + + (setq auto-save-visited-predicate + (lambda () (and (eq major-mode \\='org-mode) + (string-match \"^/home/skangas/org/\" + buffer-file-name)))) + +If the value of this variable is not a function, it is ignored. +This is the same as having a predicate that always returns +non-nil." + :group 'auto-save + :type '(choice :tag "Function:" + (const :tag "No extra predicate" :value nil) + (function :tag "Predicate function" :value always)) + :risky t + :version "29.1") + +(defcustom remote-file-name-inhibit-auto-save-visited nil + "When nil, `auto-save-visited-mode' will auto-save remote files. +Any other value means that it will not." + :group 'auto-save + :type 'boolean + :version "29.1") + (define-minor-mode auto-save-visited-mode - "Toggle automatic saving to file-visiting buffers on or off. + "Toggle automatic saving of file-visiting buffers to their files. - When this mode is enabled, visited files are saved automatically. - The user option `auto-save-visited-interval' controls how often. + When this mode is enabled, file-visiting buffers are automatically + saved to their files. This is in contrast to `auto-save-mode', which + auto-saves those buffers to a separate file, leaving the original + file intact. See Info node `Saving' for details of the save process. - Unlike `auto-save-mode', this mode will auto-save buffer contents - to the visited files directly and will also run all save-related - hooks. See Info node `Saving' for details of the save process. + The user option `auto-save-visited-interval' controls how often to + auto-save a buffer into its visited file. +You can use `auto-save-visited-predicate' to control which +buffers are saved. + You can also set the buffer-local value of the variable `auto-save-visited-mode' to nil. A buffer where the buffer-local value of this variable is nil is ignored for the purpose of